import Foundation

enum ResponseHintType: Int {
    
    /**
     * 当hint不为0并且msg不为空时，用不同的方式展示msg
     */
    
    /// 无提示
    case TYPE_HINT_NONE = 0
    /// 成功toast
    case TYPE_HINT_SUCCESS_TOAST
    /// 错误toast
    case TYPE_HINT_ERROR_TOAST
    /// dialog提示
    case TYPE_HINT_DIALOG
}

struct ResponseModel : Mappable {
    
    var code: Int = -1
    var success = true
    var msg = "网络异常，请检查网络！"
    var error = ""
    var data: Any?
    var total = 0
    var hint = 0
    
    init() {
    }
    
    init?(map: Map) {
        
    }
    
    mutating func mapping(map: Map) {
        
        code <- map["code"]
        success <- map["success"]
        msg <- map["msg"]
        error <- map["error"]
        data <- map["data"]
        data <- map["rows"]
        total <- map["total"]
        hint <- map["hint"]
        
    }
    
}

struct ResponseSummariesModel: Mappable {
    
    /// 翻页时必填前页返回的list_id值-多多联盟翻页使用
    var listId: String?
    
    init() {
    }
    
    init?(map: Map) {
        
    }
    
    mutating func mapping(map: Map) {
        listId <- map["listId"]
    }
    
}

struct DialogMessage {
    
    private var _message: String = "请求失败，请检查网络!"
    /// 请求回调提示信息
    var message: String {
        set {
            _message = newValue
        }
        get {
            return _message.localized
        }
    }
    /// 请求是否成功
    var isSuccess = false
    /// 请求状态码
    var code = -1
    /// 成功后返回的数据
    var data: Any?
    
}


